#ifndef __BRANCH1_MODEL_XML_TERRAIN_ACT_TEST_SCENE_H__
#define __BRANCH1_MODEL_XML_TERRAIN_ACT_TEST_SCENE_H__
#include "ModelConfig.h"
#include "KnowledgeCenter.h"
#include <boost\function.hpp>
#include <ogre\Ogre.h>
#include <OgreNewt.h>
#include <Terrain\OgreTerrain.h>
#include <Terrain\OgreTerrainGroup.h>
#include <PagedGeometry.h>
#include "GrassLoader.h"
namespace Branch1{
	class XMLLoadTerrainAct:public Action
	{
	public:
		XMLLoadTerrainAct(Office* office,Ogre::SceneManager* sceneMgr,OgreNewt::World* world,Ogre::Light* light,Ogre::Camera* camera);
		~XMLLoadTerrainAct();
		bool execute();

	public:
		//terrrain
		Ogre::SceneManager* mSceneMgr;
		Ogre::Light* mLight;
		OgreNewt::World* mWorld;
		Ogre::Camera* mCamera;
		Ogre::Terrain* mTerrain;
		Ogre::TerrainGlobalOptions* mTerrainGlobals;
		static Ogre::TerrainGroup* mTerrainGroup;
		bool mTerrainsImported;
		bool mIsInit;
		//pageGeometry
		boost::scoped_ptr<Forests::PagedGeometry> grass;
		Forests::GrassLoader *grassLoader;

		void defineTerrain(long x, long y) ;
		void getTerrainImage(bool flipX, bool flipY, Ogre::Image& img);
		void initBlendMaps(Ogre::Terrain* terrain);
		static Ogre::Real getTerrainHeight(const Ogre::Real x, Ogre::Real z, void *userData);


	};
}
#endif